<?php
namespace test\primary;

/**
 * Created by PhpStorm.
 * User: Antique
 * Date: 2021/12/10
 * Time: 上午 12:26
 */
class sql_action
{
    public static $conn;

    public static function set_conn($conn)
    {
        self::$conn = $conn;
    }

    public static function select_get_data($sql)
    {
        $result = self::$conn->query($sql);
        $data= $result->fetch_assoc();
        return $data;
    }
    public static function select_test($sql)
    {
        $result = self::$conn->query($sql);
        $data = $result->fetch_assoc();
        if (is_array($data)) {
            return true;
        } else {
            return false;
        }
    }
	public static function Add($sql){
		 $result = self::$conn->query($sql);
		 return $result;
	}
    public static function Change($sql){
        $result = self::$conn->query($sql);
        if($result){
        if(mysqli_affected_rows(self::$conn)==1){
            return $result;
        }else{
            return false;
        }
        }else{
            return false;
        }

    }
}

?>

